package com.chzc.fm.duotin.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import com.chzc.fm.duotin.R;
import com.chzc.fm.duotin.bean.channel.AnchorSpecial;

import java.util.List;

/**
 * Created by Administrator on 2016/6/24.
 */
public class AnchorLayout extends LinearLayout {

    private AnchorItem ai1,ai2,ai3;

    private List<AnchorSpecial> specialList;

    public List<AnchorSpecial> getSpecialList() {
        return specialList;
    }

    public void setSpecialList(List<AnchorSpecial> specialList) {

        this.specialList = specialList;

        setAnchorItem();
    }

    public AnchorLayout(Context context) {
        super(context);

        initViews(context);



    }

    public AnchorLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        initViews(context);
    }

    public void initViews(Context context)
    {
        inflate(context, R.layout.anchor_layout,this);

        ai1 = (AnchorItem) findViewById(R.id.anchor_layout_ai1);
        ai2 = (AnchorItem) findViewById(R.id.anchor_layout_ai2);
        ai3 = (AnchorItem) findViewById(R.id.anchor_layout_ai3);
    }

    public void setAnchorItem()
    {
        /*ai1 = new AnchorItem(getContext(),specialList.get(0));
        addView(ai1);
        ai2 = new AnchorItem(getContext(),specialList.get(1));
        addView(ai2);
        ai3 = new AnchorItem(getContext(),specialList.get(2));
        addView(ai3);*/
        ai1.setItems(specialList.get(0));
        ai2.setItems(specialList.get(1));
        ai3.setItems(specialList.get(2));

    }
}
